package top.kaoshanji.ch08;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import top.kaoshanji.ch08.pair2.ArrayAlg;
import top.kaoshanji.ch08.pair2.Pair;

import java.time.LocalDate;

/**
 * 代码清单 ch08-02：类型变量的限定(8.4节)
 * author kaoshanji
 * ^_^
 * create time 2024/11/28 17:08
 */
public class PairTest2 {

    private static final Logger logger = LogManager.getLogger(PairTest2.class);

    public static void main(String[] args) {
        logger.info("...代码清单 ch08-02：类型变量的限定(8.4节)...");

        LocalDate[] birthdays =
                {
                        LocalDate.of(1906, 12, 9), // G. Hopper
                        LocalDate.of(1815, 12, 10), // A. Lovelace
                        LocalDate.of(1903, 12, 3), // J. von Neumann
                        LocalDate.of(1910, 6, 22), // K. Zuse
                };

        Pair<LocalDate> mm = ArrayAlg.minmax(birthdays);

        System.out.println("min = " + mm.getFirst());
        System.out.println("max = " + mm.getSecond());

    }

}
